﻿@model MvcFront.DB.Document

<legend>@Html.DisplayFor(model => model.DocAppointment.Name)</legend>

<div class="display-label">Владелец</div>
<div class="display-field">
    @Html.DisplayFor(model => model.UserAccount.FullName)
</div>

<div class="display-label">@Html.LabelFor(model => model.DocAppointment.Name)</div>
<div class="display-field">
    @Html.DisplayFor(model => model.DocAppointment.Name)
</div>

<div class="display-label">@Html.LabelFor(model => model.CreationDate)</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.CreationDate)
    </div>

    <div class="display-label">@Html.LabelFor(model => model.LastEditDate)</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.LastEditDate)
    </div>

    <div class="display-label">@Html.LabelFor(model => model.DocStatusText)</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.DocStatusText)
    </div>
    @if (Model.DocAppointment.DocTemplate.AllowAttachment)
    {
        <div class="display-label">@Html.LabelFor(model => model.DisplayFileName)</div>
        <div class="display-field">
            @Html.DisplayFor(model => model.DisplayFileName)
            @if(!string.IsNullOrEmpty(Model.StoredFileName))
            {
                @Html.ActionLink("Скачать", "DownloadDocAttachment", "Dictionary", new { documentId = Model.documentid }, new { target = "_blank" })
            }
        </div>
    }
    <div class="display-label">@Html.LabelFor(model => model.LastComment)</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.LastComment)
    </div>

     <table id="FieldsTable">
        <tr><th>Наименование</th><th>Значение</th></tr>
        @{
            foreach (var field in Model.DocFields.OrderBy(x=>x.FieldTemplate.OrderNumber))
            {
                <tr>
                    <td>@field.FieldTemplate.FieldName</td>
                    <td>@field.GetValueString()</td>
                </tr>
            }
        }
    </table>
